From 5955ea8a53af40f1da118ad708c8144a0035bf2a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 5 Mar 2015 12:11:08 -0800 Subject: [PATCH] Explicitly remove RUST_LOG when crawling output Ensure we don't get erroneous information about invalid log levels or such. Closes #1381 --- src/cargo/ops/cargo_rustc/context.rs | 3 ++- tests/test_cargo_compile.rs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index 409d1f761..f6ec075b7 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -96,7 +96,8 @@ impl<'a, 'b: 'a> Context<'a, 'b> { .arg("--crate-name").arg("_") .arg("--crate-type").arg("dylib") .arg("--crate-type").arg("bin") - .arg("--print=file-names"); + .arg("--print=file-names") + .env_remove("RUST_LOG"); if let Some(s) = target { process.arg("--target").arg(s); }; diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index ae0022821..1023338ed 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -1158,7 +1158,9 @@ test!(simple_staticlib { "#) .file("src/lib.rs", "pub fn foo() {}"); - assert_that(p.cargo_process("build"), execs().with_status(0)); + // env var is a test for #1381 + assert_that(p.cargo_process("build").env("RUST_LOG", "nekoneko=trace"), + execs().with_status(0)); }); test!(staticlib_rlib_and_bin { -- 2.30.2